#define _CRT_SECURE_NO_WARNINGS
#include"lian.h"
void SLprintf(SL* lu)
{
	SL* arr = lu->xia;
	while (arr != lu)
	{
		printf("%d->", arr->shu);
		arr = arr->xia;
	}
	printf("NULL\n");
}
SL* xin(leixing x)
{
	SL* arr = (SL*)malloc(sizeof(leixing));
	if (arr == NULL)
	{
		perror("malloc arr");
		exit(1);
	}
	arr->shu = x;
	arr->shang = arr->xia = arr;
	return arr;
}
void SLinit(SL** lu)
{
	*lu = xin(-1);
}
void SLwiecha(SL* lu, leixing x)
{
	assert(lu);
	SL* arr = xin(x);
	arr->shang = lu->shang;
    arr->xia = lu;
	lu->shang->xia = arr;
	lu->shang = arr;
}